home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 June: Reference Library / Dev.CD Jun 00 RL Disk 1.toast / pc / technical documentation / develop / develop issue 26 / develop issue 26 code / wide (64 bit) library / includes / wide.h
Encoding:
C/C++ Source or Header  |  1996-08-05  |  5.0 KB  |  236 lines

  1. /**********************************************************
  2.  
  3.     Wide.h
  4.  
  5.     Author:
  6.         Dale Semchishen, 1996
  7.         Modified by Terry Teague for MPW
  8.  
  9.     Description:
  10.         Function Prototypes for the Wide library
  11.  
  12.         If this library is built without the QuickDraw GX
  13.         includes on a 680x0 then all routines will be linked in.
  14.  
  15.         If this library is built with QuickDraw GX on a 680x0
  16.         then only WideInit(), WideAssign32(), WideAdd32(),
  17.         WideSub32(), WideToDecStr() and WideBitShift() will
  18.         be linked in. The other Wide routines are supported
  19.         by QuickDraw GX.
  20.  
  21.         To build this library for a QuickDraw GX environment
  22.         include the file <GXTypes.h> or <GXMath.h> before "Wide.h"
  23.  
  24.  **********************************************************/
  25.  
  26. #ifndef __WIDE__
  27. #define __WIDE__
  28.  
  29. #ifndef __TYPES__
  30. #include <Types.h>
  31. #endif
  32.  
  33. /* All the conditional macros (if they exist) have been defined */
  34.  
  35. #ifndef    UNIVERSAL_INTERFACES_VERSION
  36.     /* This conditional did not exist prior to Universal Headers version 2.1 */
  37.  
  38.     #ifndef GENERATING68K
  39.         /* This conditional did not exist prior to Universal Headers version 2.0 */
  40.  
  41.         #ifndef USES68KINLINES
  42.             /* This conditional did not exist prior to Universal Headers version 1.0 */
  43.  
  44.             /* 68K only supported */
  45.             #define GENERATING68K 1
  46.  
  47.             struct wide {
  48.                 long                        hi;
  49.                 unsigned long                lo;
  50.             };
  51.             typedef struct wide wide;
  52.             
  53.             struct UnsignedWide {
  54.                 unsigned long                hi;
  55.                 unsigned long                lo;
  56.             };
  57.             typedef struct UnsignedWide UnsignedWide;
  58.  
  59.         #else
  60.         #endif
  61.         
  62.         /* not defined in Types.h for Universal Headers version 1.0 */
  63.         /* or pre-Universal Headers */
  64.         typedef wide *WidePtr;
  65.         typedef UnsignedWide *UnsignedWidePtr;
  66.  
  67.         /* define this for the library internal use */
  68.         #define    NEED_EXTENDED80    1
  69.  
  70.     #else
  71.     #endif
  72.  
  73. #else
  74. #endif
  75.  
  76. /* IF generating code for 680x0 CPUs --------------------*/
  77. #if GENERATING68K
  78.  
  79. #ifndef __SANE__
  80. #include <SANE.h>
  81. #endif
  82.  
  83. /* IF compiling with MetroWorks, map SANE decimal type because 
  84.    they don't follow the name defined in PowerPC Numerics */
  85. #ifdef __MWERKS__
  86. typedef Decimal decimal;
  87. #endif
  88.  
  89. /* IF Quickdraw GX return values have not been defined */
  90. #ifndef __GXMATH__
  91. #ifndef __cplusplus
  92. #define fixed Fixed
  93. #endif
  94. #define gxPositiveInfinity ((Fixed) 0x7FFFFFFFL)
  95. #define gxNegativeInfinity ((Fixed) 0x80000000L)
  96. #endif
  97.  
  98. /* ELSE generating code for PowerPC ---------------------*/
  99. #else
  100.  
  101. #ifndef __FP__
  102. #include <fp.h>
  103. #endif
  104.  
  105. /* IF Quickdraw GX return values have not been defined */
  106. #ifndef __GXMATH__
  107. #define gxPositiveInfinity ((long) 0x7FFFFFFFL)
  108. #define gxNegativeInfinity ((long) 0x80000000L)
  109. #endif
  110.  
  111. #endif
  112.  
  113.  
  114. #ifdef __cplusplus
  115. extern "C" {
  116. #endif
  117.  
  118.  
  119.  
  120. /*------------------ Function Prototypes ------------------*/
  121.  
  122. void WideInit( void );
  123.  
  124. wide *WideAssign32
  125. (
  126.     wide    *target_ptr,        /* out: 64 bits to be assigned */
  127.     long          value            /* in:  assignment value */
  128. );
  129.  
  130. wide *WideAdd32
  131. (
  132.     wide    *target_ptr,        /* out: 64 bits to be added to */
  133.     long     value              /* in:  addition value */
  134. );
  135.  
  136. wide *WideSubtract32
  137. (
  138.     wide    *target_ptr,        /* out: 64 bits to be subtracted from */
  139.     long     value                /* in:  subtraction value */
  140. );
  141.  
  142. void WideToDecStr
  143. (
  144.         decimal *decstr_ptr,    /* out: decimal output string */
  145.     const wide  *source_ptr        /* in:  64 bit int to convert */
  146. );
  147.  
  148.  
  149. /* IF QuickDraw GX is not included */
  150. #ifndef __GXMATH__
  151.  
  152. short WideScale
  153. (
  154.     const wide  *bigint_ptr        /* in: 64 bits */
  155. );
  156.  
  157. #endif
  158.  
  159.  
  160. /* IF generating code for 680x0 CPUs */
  161. #if GENERATING68K
  162.  
  163. wide *WideBitShift
  164. (
  165.     wide    *target_ptr,        /* in/out: 64 bits to be shifted */
  166.     short       amount            /* in:     shift amount (+ right, - left) */
  167. );
  168.  
  169.  
  170. /* IF QuickDraw GX is not included */
  171. #ifndef __GXMATH__
  172.  
  173. wide *WideAdd
  174. (
  175.           wide  *target_ptr,    /* out: 64 bits to be added to */
  176.     const wide  *source_ptr        /* in:  addition value */
  177. );
  178.  
  179. short WideCompare
  180. (
  181.     const wide    *target_ptr,    /* in: first value */
  182.     const wide    *source_ptr        /* in: second value */
  183. );
  184.  
  185. long WideDivide
  186. (
  187.     const wide *dividend_ptr,    /* in:  64 bits to be divided */
  188.     long        divisor,        /* in:  value to divide by */
  189.     long       *remainder_ptr    /* out: the remainder of the division */
  190. );
  191.  
  192. wide *WideWideDivide
  193. (
  194.     wide    *dividend_ptr,        /* in/out:  64 bits to be divided */
  195.     long    divisor,            /* in:      value to divide by */
  196.     long   *remainder_ptr        /* out:     the remainder of the division */
  197. );
  198.  
  199. wide *WideMultiply
  200. (
  201.     long    multiplicand,        /* in:  first value to multiply */
  202.     long    multiplier,            /* in:  second value to multiply */
  203.     wide   *target_ptr            /* out: 64 bits to be assigned */
  204. );
  205.  
  206. wide *WideNegate
  207. (
  208.     wide    *target_ptr            /* in/out: 64 bit integer to be negated */
  209. );
  210.  
  211. wide *WideShift
  212. (
  213.     wide    *target_ptr,        /* in/out: 64 bits to be shifted */
  214.     short       amount          /* in:     shift amount (+ right, - left) */
  215. );
  216.  
  217. unsigned long WideSquareRoot
  218. (
  219.     const wide  *source_ptr        /* in:  value to take the square root of */
  220. );
  221.  
  222. wide *WideSubtract
  223. (
  224.           wide  *target_ptr,    /* out: 64 bit int to be subtracted from */
  225.     const wide  *bigint2_ptr    /* in:  subtraction value */
  226. );
  227.  
  228. #endif
  229.  
  230. #endif
  231.  
  232. #ifdef __cplusplus
  233. }
  234. #endif
  235.  
  236. #endif